#ifndef __NONAME_CPPCRT_H__
#define __NONAME_CPPCRT_H__

#define NONAME_LIB_USE

#include <ntifs.h>
#include "nm_mem.h"

extern "C" NTSTATUS __cdecl NM_DriverEntry(PDRIVER_OBJECT DriverObject, PUNICODE_STRING RegPath);
typedef void(__cdecl* KCRT_FUNCTION)();

class AtExitCall {

public:
	AtExitCall(KCRT_FUNCTION func) : 
	  m_Func(func), m_Next(m_ExitList) { m_ExitList = this; }
	  ~AtExitCall() { m_Func(); m_ExitList = m_Next; }

public:
	static void do_exit_calls() { while(m_ExitList) delete m_ExitList; }

private:
	KCRT_FUNCTION m_Func;
	AtExitCall* m_Next;
	static AtExitCall *m_ExitList;
};

#endif